import React, { Component } from 'react'

export class Header extends Component {
  render() {
      let {tablist,i,change}=this.props
    return (
      <div>
          {tablist.length?tablist.map((item,index)=>{
            return <button key={item.id}
            className={i===index?'on':''}
            onClick={()=>{
                change(index)
            }}
            >{item.title}</button>
          }):'暂无数据'}
      </div>
    )
  }
}

export default Header